<template>
  <div class="app">
    <myHeader title="TabBar 作业"></myHeader>
    <keep-alive><components :is="activatedComponent"></components></keep-alive>
    <myTabBar :list="tabList" @ckAction="ckFn"></myTabBar>
  </div>
</template>

<script>
import myHeader from "./components/MyHeader";
import myTabBar from "./components/MyTabBar";
import myGoodsList from "./views/MyGoodsList";
import myGoodsSearch from "./views/MyGoodsSearch";
import myUserInfo from "./views/MyUserInfo";

export default {
  methods: {
    ckFn(index) {
      this.activatedComponent = this.tabList[index].componentName;
    },
  },
  data() {
    return {
      activatedComponent: "myGoodsList",
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "myGoodsList",
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "myGoodsSearch",
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "myUserInfo",
        },
      ],
    };
  },
  components: {
    myHeader,
    myTabBar,
    myGoodsList,
    myGoodsSearch,
    myUserInfo,
  },
};
</script>

<style>
.app {
  padding: 50px;
}
</style>
